package com.smart.system.service.impl;

import java.util.Arrays;
import java.util.List;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.smart.common.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.smart.system.mapper.AbnormalOperationMapper;
import com.smart.system.domain.AbnormalOperation;
import com.smart.system.service.IAbnormalOperationService;

/**
 * 异常作业Service业务层处理
 * 
 * @author smart
 * @date 2024-09-18
 */
@Service
public class AbnormalOperationServiceImpl extends ServiceImpl<AbnormalOperationMapper,AbnormalOperation> implements IAbnormalOperationService {

    /**
     * 查询异常作业
     * 
     * @param id 异常作业主键
     * @return 异常作业
     */
    @Override
    public AbnormalOperation selectAbnormalOperationById(String id)
    {
        return this.baseMapper.selectById(id);
    }

    /**
     * 查询异常作业列表
     * 
     * @param abnormalOperation 异常作业
     * @return 异常作业
     */
    @Override
    public List<AbnormalOperation> selectAbnormalOperationList(AbnormalOperation abnormalOperation)
    {
        return this.list(Wrappers.lambdaQuery(abnormalOperation));
    }

    /**
     * 新增异常作业
     * 
     * @param abnormalOperation 异常作业
     * @return 结果
     */
    @Override
    public int insertAbnormalOperation(AbnormalOperation abnormalOperation)
    {
        abnormalOperation.setCreateTime(DateUtils.getNowDate());
        return this.baseMapper.insert(abnormalOperation);
    }

    /**
     * 修改异常作业
     * 
     * @param abnormalOperation 异常作业
     * @return 结果
     */
    @Override
    public int updateAbnormalOperation(AbnormalOperation abnormalOperation)
    {
        abnormalOperation.setUpdateTime(DateUtils.getNowDate());
        return this.baseMapper.updateById(abnormalOperation);
    }

    /**
     * 批量删除异常作业
     * 
     * @param ids 需要删除的异常作业主键
     * @return 结果
     */
    @Override
    public int deleteAbnormalOperationByIds(String[] ids)
    {
        return this.baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除异常作业信息
     * 
     * @param id 异常作业主键
     * @return 结果
     */
    @Override
    public int deleteAbnormalOperationById(String id)
    {
        return this.baseMapper.deleteById(id);
    }
}
